home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mntdoc01.zoo / mintdoc / cat3 / mktemp.3 < prev    next >
Encoding:
Text File  |  1993-03-03  |  1.8 KB  |  67 lines

  1.  
  2.  
  3.  
  4. MKTEMP(3)           MINTLIB LIBRARY FUNCTIONS           MKTEMP(3)
  5.  
  6.  
  7. N✓NA✓AM✓ME✓E
  8.        mktemp - make a unique file name
  9.  
  10. S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
  11.        #include <unistd.h>
  12.  
  13.        char *mktemp(char *template);
  14.  
  15. D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
  16.        mktemp  creates  a unique file name, typically in a tempo-
  17.        rary filesystem, by replacing template with a unique  file
  18.        name,  and  returns the address of template. The string in
  19.        template should contain a file name with six trailing  Xs;
  20.        mktemp  replaces the Xs with a number and the current pro-
  21.        cess ID.  The number will be chosen so that the  resulting
  22.        name does not duplicate an existing file.
  23.  
  24. R✓RE✓ET✓TU✓UR✓RN✓N V✓VA✓AL✓LU✓UE✓ES✓S
  25.        mktemp  returns  a pointer to the changed template on suc-
  26.        cess, and NULL on failure.
  27.  
  28. S✓SE✓EE✓E A✓AL✓LS✓SO✓O
  29.        g✓ge✓et✓tp✓pi✓id✓d(✓(3✓3)✓),✓, o✓op✓pe✓en✓n(✓(3✓3)✓),✓, t✓tm✓mp✓pf✓fi✓il✓le✓e(✓(3✓3)✓),✓, t✓tm✓mp✓pn✓na✓am✓m(✓(3✓3)✓)
  30.  
  31. N✓NO✓OT✓TE✓ES✓S
  32.        The related UN*X function mkstemp is currently not  avail-
  33.        able in the mintlibs.
  34.  
  35.        mktemp  actually  changes  the  template  string which you
  36.        pass; this means that you cannot  use  the  same  template
  37.        string  more  than  once  -  you need a fresh template for
  38.        every unique file you want to open.
  39.  
  40.        When mktemp is creating a new unique  filename  it  checks
  41.        for  the  prior  existence  of a file with that name. This
  42.        means that if you are creating more than one unique  file-
  43.        name, it is bad practice to use the same root template for
  44.        multiple invocations of mktemp.
  45.  
  46.        The current process id is used only  if  there  is  enough
  47.        room in the string and MiNT is active.
  48.  
  49. B✓BU✓UG✓GS✓S
  50.        It is possible to run out of numbers.
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. MiNT docs 0.1              3 March 1993                         1
  65.  
  66.  
  67.